Run Input and TextArea key bindings inline to keep ordering with type…#6631
Open
dobbydobap wants to merge 1 commit into
Open
Run Input and TextArea key bindings inline to keep ordering with type…#6631dobbydobap wants to merge 1 commit into
dobbydobap wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does: Printable characters are handled directly in
Input._on_key/TextArea._on_key, but bound keys (backspace, arrows, ctrl+k, …) bubbled up to the app before their action ran. Under fast input the next character could be inserted while a bound key was still in transit, so operations applied out of order. This adds a smallWidget._run_key_bindingshelper that runs the widget's own non-priority bindings inline in_on_key,using the samerun_actionresolution the app would use. Since the focused widget is the first namespace in the binding chain anyway, and priority bindings are checked before the event reaches the widget, what runs is unchanged only when.Why: Fixes #6605.
How I tested it: New regression tests post
b, a, backspace, cwithout waiting between keys; on main they produceba, with the fixbc. Full suite passes locally on Windows (3460 passed; one unrelated pre-existing failure intest_suspendthat also fails on a clean checkout on my machine).Notes: MaskedInput inherits Input's handler, so it's covered. Keys bound on ancestor widgets can in principle still reorder relative to typing, but the widget's own editing keys the case in the issue can't anymore. Happy to adjust the approach if you'd rather fix this at a different level.